Skip to main content

libobs_simple\sources\linux\sources/
pulse_input.rs

1use libobs_simple_macro::obs_object_impl;
2use libobs_wrapper::sources::ObsSourceRef;
3
4use crate::sources::macro_helper::{define_object_manager, impl_default_builder};
5
6define_object_manager!(
7    #[derive(Debug)]
8    /// A source for PulseAudio audio input.
9    ///
10    /// This source captures audio from PulseAudio devices on Linux systems.
11    /// PulseAudio is a higher-level sound server that sits on top of ALSA
12    /// and provides more advanced audio routing and mixing capabilities.
13    struct PulseInputSource("pulse_input_capture", *mut libobs::obs_source) for ObsSourceRef {
14        /// PulseAudio device name/ID
15        #[obs_property(type_t = "string")]
16        device_id: String,
17    }
18);
19
20define_object_manager!(
21    #[derive(Debug)]
22    /// A source for PulseAudio audio input.
23    ///
24    /// This source captures audio from PulseAudio devices on Linux systems.
25    /// PulseAudio is a higher-level sound server that sits on top of ALSA
26    /// and provides more advanced audio routing and mixing capabilities.
27    struct PulseOutputSource("pulse_output_capture", *mut libobs::obs_source) for ObsSourceRef {
28        /// PulseAudio device name/ID
29        #[obs_property(type_t = "string")]
30        device_id: String,
31    }
32);
33
34#[obs_object_impl]
35impl PulseInputSource {
36    /// Set the default PulseAudio input device
37    pub fn set_default_device(self) -> Self {
38        self.set_device_id("default")
39    }
40}
41
42#[obs_object_impl]
43impl PulseOutputSource {
44    /// Set the default PulseAudio output device
45    pub fn set_default_device(self) -> Self {
46        self.set_device_id("default")
47    }
48}
49
50impl_default_builder!(PulseInputSourceBuilder);
51impl_default_builder!(PulseOutputSourceBuilder);